package com.wistech.search.solr.extend;

import org.springframework.beans.factory.annotation.Required;

import com.wistech.search.solr.extend.model.Product;
import com.wistech.search.solr.extend.service.ProductManager;

public class ProductScoreHandler extends ScoreHandler<Product> implements
		DocumentHander {
	private ProductManager productManager;

	@Override
	public Product getEntity(Object id) {
		if (id instanceof String) {
			id = Long.parseLong((String) id);
		}
		return productManager.getProduct((Long) id);
	}

	/**
	 * @param productManager
	 *            the productManager to set
	 */
	@Required
	public void setProductManager(ProductManager productManager) {
		this.productManager = productManager;
	}
}
